<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="<%=basePath%>Js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/mycss/bootstrap.min.css" />
</head>
<script type="text/javascript">

//通过楼层、房间动态、房型条件查询房间信息
function selectRoomByother(){
	
	var floor = $("#floor").find("option:selected").text();
	var state = "空闲";
	var houseType = $("#houseType").find("option:selected").text();
	
	$.ajax({
		type:"post",
		url:"selectRoomByother4.do",
		data:{
			"floor":floor,
			"state":state,
			"houseType":houseType,
		},
		success:function(result){
			
			stus = JSON.parse(result)
				var stu = "";
			stu +="<select name='roomNumber' id='roomNumber' class='form-control'>";
			for(var i = 0; i < stus.length; i++ ){
					stu +="<option value=''>"+stus[i].roomnum+"</option>";
				
			}
			stu +="</select>";
			$("#roomTable").html(stu);
			
		},
		error:function(){
			alert("请求失败");
		}
	})

}

function nonmemberCheckin(){
	var name = $("#Name").val();
	var Idnumber = $("#Idnumber").val();
	var Address = $("#Address").val();
	var people = $("#people").val();
	var roomNumber = $("#roomNumber").find("option:selected").text();
	var remarks = $("#remarks").val();
	
	$.ajax({
		type:"post",
		url:"nonmemberCheckin2.do",
		data:{
			"name":name,
			"Idnumber":Idnumber,
			"Address":Address,
			"people":people,
			"roomNumber":roomNumber,
			"remarks":remarks,
		},
		dataType:"text",
		success:function(result){
			if(result == "1"){
				alert("办理入住成功")
			}else{
				alert("办理入住失败")
			}
		},
		error:function(){
			alert("请求失败");
		}
	})
	
}

</script>
<body>
<hr><h3 align="center">非会员入住办理</h3><hr><br>
	<div style="position: absolute; left: 300px; top: 150px; width: 720px; height: 10px">
		<table class="table table-bordered">
			<tr>
				<td>姓名:</td>
				<td><input type="text" class="form-control" id="Name"
					placeholder="请输入姓名"></td>
				<td>身份证号码:</td>
				<td><input type="text" class="form-control" id="Idnumber"
					placeholder="请输入身份证号码"></td>
			</tr>
			<tr>
				<td>居住地址:</td>
				<td><input type="text" class="form-control" id="Address"
					placeholder="请输入居住地址"></td>
				<td>入住人数:</td>
				<td><input type="text" class="form-control" id="people"
					placeholder="请输入入住人数"></td>
			</tr>
			<tr>
			<td>查找空房</td>
			<td >
			<div>
			 选择楼层：<select name="floor" id="floor" class="">

						<option value="0">默认</option>
						<c:forEach items="${floorlist}" var="floorlist">

						<option value="1">${floorlist.floor}</option>
						</c:forEach>
				</select>
			选择房型：<select name="houseType" id="houseType" class="">
				
				  <option value="0">默认</option>
				  
				  <c:forEach items="${houselist}" var="list">
	              <option value="0">${list.housetype}</option>
	              </c:forEach>
	           </select>
	           <button class="" onclick="selectRoomByother()">确定</button>
			</div>
			</td>
				<td>房间选择:</td>
				<td id="roomTable"></td>
			</tr>
			<tr>
			<td>备注</td>
			<td colspan="3"><textarea rows="3" cols="50" name="remarks" id="remarks" class="form-control"></textarea></td>
			</tr>
			<tr>
			<td colspan="4">
			<div align="right">
			<button type="button" onclick="nonmemberCheckin()" class="btn btn-success">入住办理</button>
			</div>
			</td>
			</tr>
		</table>
	</div>


</body>
</html>